<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<!-- Mirrored from www.wolfssl.com/wolfSSL/Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Jan 2017 13:33:22 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="Generator" content="iWeb 3.0.4"/>
<meta name="iWeb-Build" content="local-build-20170103"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<meta name="viewport" content="width=770"/>
<title>wolfSSL - Docs | wolfSSL Manual - Chapter 17.3 (API Reference, Context and Session Setup)</title>
<link rel="stylesheet" type="text/css" media="screen,print" href="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup.css"/>
<!--[if lt IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setupIE.css'/><![endif]-->
<!--[if gte IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Media/IE8.css'/><![endif]-->
<script type="text/javascript" src="Scripts/iWebSite.js"></script>
<script type="text/javascript" src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup.js"></script>
<meta name="description" content="wolfSSL API reference functions related to the SSL/TLS context and session setup."/><meta name="keywords" content="embedded ssl, ssl library, lightweight ssl, open source ssl, open source web server, tls 1.2, embedded security, small openssl, smart grid, connected home, ecc, suite b, fips, encryption security software, ssl inspection"/><meta name="robots" content="follow,index"/> <script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','../../www.google-analytics.com/analytics.js','ga');ga('create','UA-64826966-1','auto');ga('send','pageview');</script>
 
<script>//<![CDATA[
window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(c){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var o=this.createElement("script");n&&(this.domain=n),o.id="js-iframe-async",o.src=e,this.t=+new Date,this.zendeskHost=t,this.zEQueue=a,this.body.appendChild(o)},o.write('<body onload="document._l();">'),o.close()}("../../assets.zendesk.com/embeddable_framework/main.js","wolfssl.zendesk.com");
//]]></script>
  </head>
<body style="background: rgb(255, 255, 255); margin: 0pt; " onload="onPageLoad();">
<div style="text-align: center; ">
<div style="margin-bottom: 20px; margin-left: auto; margin-right: auto; margin-top: 20px; overflow: hidden; position: relative; word-wrap: break-word;  background: rgb(255, 255, 255); text-align: left; width: 770px; " id="body_content">
<div style="float: left; margin-left: 0px; position: relative; width: 770px; z-index: 0; " id="nav_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
<div style="clear: both; height: 0px; line-height: 0px; " class="spacer"> </div>
</div>
<div style="float: left; height: 0px; line-height: 0px; margin-left: 0px; position: relative; width: 770px; z-index: 10; " id="header_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
</div>
<div style="margin-left: 0px; position: relative; width: 770px; z-index: 5; " id="body_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
<div id="id1" style="height: 38px; left: 375px; position: absolute; top: 157px; width: 361px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_361_38" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style">wolfSSL Manual</p>
</div>
</div>
</div>
<div id="id2" style="height: 24px; left: 193px; position: absolute; top: 122px; width: 268px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_268_24" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_1"><a class="class1" title="Docs.html" href="Docs.html">Docs</a> <span class="style">-&gt;</span> <span class="style_1">wolfSSL Manual</span></p>
</div>
</div>
</div>
<div style="height: 1px; width: 698px;  height: 1px; left: 37px; position: absolute; top: 220px; width: 698px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 698px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_1.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 698px; "/>
</div>
</div>
<div style="height: 37px; width: 545px;  height: 37px; left: 191px; position: absolute; top: 80px; width: 545px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 545px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_2.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 545px; "/>
</div>
</div>
<div id="id3" style="height: 25px; left: 200px; position: absolute; top: 84px; width: 43px; z-index: 1; " class="style_SkipStroke_1 shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_43_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_2"><a class="class2" title="Home.html" href="Home.html">Home</a></p>
</div>
</div>
</div>
<div id="id4" style="height: 25px; left: 365px; position: absolute; top: 84px; width: 72px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_72_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_3"><a class="class3" title="https://wolfssl.com/wolfSSL/download/downloadForm.php" href="https://wolfssl.com/wolfSSL/download/downloadForm.php">Download</a></p>
</div>
</div>
</div>
<div id="id5" style="height: 25px; left: 439px; position: absolute; top: 84px; width: 59px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_59_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_3"><a class="class4" title="License.html" href="License.html">License</a></p>
</div>
</div>
</div>
<div id="id6" style="height: 25px; left: 499px; position: absolute; top: 84px; width: 44px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_44_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_3"><a class="class5" title="Blog/Blog.html" href="Blog/Blog.html">Blog</a></p>
</div>
</div>
</div>
<div id="id7" style="height: 25px; left: 589px; position: absolute; top: 84px; width: 80px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_80_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_3"><a class="class6" title="Community.html" href="Community.html">Community</a></p>
</div>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 245px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_3.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 296px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_4.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 363px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_5.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 438px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_6.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 498px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_7.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 589px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_8.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div id="id8" style="height: 25px; left: 671px; position: absolute; top: 84px; width: 61px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_61_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_3"><a class="class7" title="Contact.html" href="Contact.html">Contact</a></p>
</div>
</div>
</div>
<div id="id9" style="height: 25px; left: 249px; position: absolute; top: 84px; width: 44px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_44_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_2"><a class="class8" title="About.html" href="About.html">About</a></p>
</div>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 670px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_9.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div id="id10" style="height: 25px; left: 298px; position: absolute; top: 84px; width: 63px; z-index: 1; " class="style_SkipStroke_1 shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_63_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_3"><a class="class9" title="Products.html" href="Products.html">Products</a></p>
</div>
</div>
</div>
<div id="id11" style="height: 25px; left: 549px; position: absolute; top: 84px; width: 41px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_41_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_2"><a class="class10" title="Docs.html" href="Docs.html">Docs</a></p>
</div>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 545px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_10.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div id="id12" style="height: 27px; left: 634px; position: absolute; top: 224px; width: 102px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_102_27" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_4"><a class="class11" title="Docs-wolfssl-manual-17-4-wolfssl-api-callbacks.html" href="Docs-wolfssl-manual-17-4-wolfssl-api-callbacks.html">Next Chapter</a></p>
</div>
</div>
</div>
<div id="id13" style="height: 25px; left: 35px; position: absolute; top: 224px; width: 125px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_125_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_5"><a class="class12" title="Docs-wolfssl-manual-17-2-wolfssl-api-certificates-keys.html" href="Docs-wolfssl-manual-17-2-wolfssl-api-certificates-keys.html">Previous Chapter</a></p>
</div>
</div>
</div>
<div id="id14" style="height: 27px; left: 59px; position: absolute; top: 190px; width: 196px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_196_27" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_6"><a class="class13" title="https://www.wolfssl.com/documentation/wolfSSL-Manual.pdf" href="https://www.wolfssl.com/documentation/wolfSSL-Manual.pdf">Download wolfSSL Manual (PDF)</a></p>
</div>
</div>
</div>
<div style="height: 22px; width: 22px;  height: 22px; left: 33px; position: absolute; top: 191px; width: 22px; z-index: 1; " class="tinyText style_SkipStroke_2">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/PDF.png" alt="" style="border: none; height: 22px; width: 22px; "/>
</div>
<div id="id15" style="height: 25px; left: 323px; position: absolute; top: 224px; width: 125px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_125_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_7"><a title="Docs-wolfssl-manual-toc.html" href="Docs-wolfssl-manual-toc.html">Table of Contents</a></p>
</div>
</div>
</div>
<div id="id16" style="height: 20064px; left: 35px; position: absolute; top: 281px; width: 701px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_701_20064" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-top: 0pt; " class="paragraph_style_8">Chapter 17: wolfSSL API Reference<br/></p>
<p class="paragraph_style_8"><br/></p>
<p class="paragraph_style_9">17.3  Context and Session Setup<br/></p>
<p class="paragraph_style_9"><br/></p>
<p class="paragraph_style_10">The functions in this section have to do with creating and setting up SSL/TLS context objects (WOLFSSL_CTX) and SSL/TLS session objects (WOLFSSL).<span class="style_2"><br/></span></p>
<p class="paragraph_style_11"><br/></p>
<p class="paragraph_style_11"><br/></p>
<div class="paragraph paragraph_style_11"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_11.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_11"><br/></p>
<p class="paragraph_style_12"><br/></p>
<p class="paragraph_style_12">CyaSSLv3_client_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaSSLv3_client_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaSSLv3_client_method() function is used to indicate that the application is a client and will only support the SSL 3.0 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function has no parameters.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaSSLv3_client_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_client_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_client_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_12.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSLv3_server_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaSSLv3_server_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaSSLv3_server_method() function is used to indicate that the application is a server and will only support the SSL 3.0 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function has no parameters.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaSSLv3_server_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_server_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_server_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_13.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSLv23_client_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaSSLv23_client_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaSSLv23_client_method() function is used to indicate that the application is a client and will support the highest protocol version supported by the server between SSL 3.0 - TLS 1.2.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">Both CyaSSL clients and servers have robust version downgrade capability.  If a specific protocol version method is used on either side, then only that version will be negotiated or an error will be returned.  For example, a client that uses TLSv1 and tries to connect to a SSLv3 only server will fail, likewise connecting to a TLSv1.1 will fail as well.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">To resolve this issue, a client that uses the CyaSSLv23_client_method() function will use the highest protocol version supported by the server and downgrade to SSLv3 if needed. In this case, the client will be able to connect to a server running SSLv3 - TLSv1.2.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function has no parameters.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaSSLv23_client_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_client_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_14.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSLv23_server_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaSSLv23_server_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaSSLv23_server_method() function is used to indicate that the application is a server and will support clients connecting with protocol version from SSL 3.0 - TLS 1.2.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function has no parameters.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaSSLv23_server_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_server_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_15.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaTLSv1_client_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaTLSv1_client_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaTLSv1_client_method() function is used to indicate that the application is a client and will only support the TLS 1.0 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaTLSv1_client_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_client_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_client_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_16.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaTLSv1_server_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaTLSv1_server_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaTLSv1_server_method() function is used to indicate that the application is a server and will only support the TLS 1.0 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaTLSv1_server_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_server_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_server_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_17.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaTLSv1_1_client_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaTLSv1_1_client_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaTLSv1_1_client_method() function is used to indicate that the application is a client and will only support the TLS 1.0 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaTLSv1_1_client_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_client_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_client_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_18.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaTLSv1_1_server_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaTLSv1_1_server_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaTLSv1_1_server_method() function is used to indicate that the application is a server and will only support the TLS 1.1 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaTLSv1_1_server_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_server_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_server_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_19.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaTLSv1_2_client_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaTLSv1_2_client_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaTLSv1_2_client_method() function is used to indicate that the application is a client and will only support the TLS 1.2 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaTLSv1_2_client_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_client_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_client_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_20.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaTLSv1_2_server_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaTLSv1_2_server_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaTLSv1_2_server_method() function is used to indicate that the application is a server and will only support the TLS 1.2 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaTLSv1_2_server_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_server_method<br/></p>
<p class="paragraph_style_10">CyaDTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_server_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_21.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_11"><br/></p>
<p class="paragraph_style_12">CyaDTLSv1_client_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaDTLSv1_client_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaDTLSv1_client_method() function is used to indicate that the application is a client and will only support the DTLS 1.0 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function is only available when CyaSSL has been compiled with DTLS support (--enable-dtls, or by defining CYASSL_DTLS).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaDTLSv1_client_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_client_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_client_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_client_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_22.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaDTLSv1_server_method<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">CYASSL_METHOD *CyaDTLSv1_server_method(void);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">The CyaDTLSv1_server_method() function is used to indicate that the application is a server and will only support the DTLS 1.0 protocol.  This function allocates memory for and initializes a new CYASSL_METHOD structure to be used when creating the SSL/TLS context with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function is only available when CyaSSL has been compiled with DTLS support (--enable-dtls, or by defining CYASSL_DTLS).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful, the call will return a pointer to the newly created CYASSL_METHOD structure.  <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">If memory allocation fails when calling XMALLOC, the failure value of the underlying malloc() implementation will be returned (typically NULL with errno will be set to ENOMEM).<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaDTLSv1_server_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSLv3_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_1_server_method<br/></p>
<p class="paragraph_style_10">CyaTLSv1_2_server_method<br/></p>
<p class="paragraph_style_10">CyaSSLv23_server_method<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_23.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">CYASSL* CyaSSL_new(CYASSL_CTX* ctx);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function creates a new SSL session, taking an already created SSL context as input.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful the call will return a pointer to the newly-created CYASSL structure.  Upon failure, <span class="style_3">NULL</span> will be returned.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ctx</span> - pointer to the SSL context, created with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL*     ssl = 0;<br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx = 0;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">if (ctx == NULL) {<br/></p>
<p class="paragraph_style_14">// context creation failed<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ssl = CyaSSL_new(ctx);<br/></p>
<p class="paragraph_style_14">if (ssl == NULL) {<br/></p>
<p class="paragraph_style_14">// SSL object creation failed<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_24.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_free<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">void CyaSSL_free(CYASSL* ssl);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function frees an allocated CYASSL object.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">No return values are used for this function.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL object, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">CyaSSL_free(ssl);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10">CyaSSL_new<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_free<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_25.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD* method);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function creates a new SSL context, taking a desired SSL/TLS protocol method for input.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful the call will return a pointer to the newly-created CYASSL_CTX.  Upon failure, NULL will be returned.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">method</span> - pointer to the desired CYASSL_METHOD to use for the SSL context. This is created using one of the CyaSSLvXX_XXXX_method() functions to specify SSL/TLS/DTLS protocol level.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_CTX*    ctx    = 0;<br/></p>
<p class="paragraph_style_14">CYASSL_METHOD* method = 0;<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">method = CyaSSLv3_client_method();<br/></p>
<p class="paragraph_style_14">if (method == NULL) {<br/></p>
<p class="paragraph_style_14">// unable to get method<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ctx = CyaSSL_CTX_new(method);<br/></p>
<p class="paragraph_style_14">if (ctx == NULL) {<br/></p>
<p class="paragraph_style_14">// context creation failed<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_26.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_CTX_free<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">void CyaSSL_CTX_free(CYASSL_CTX* ctx);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function frees an allocated CYASSL_CTX object.  This function decrements the CTX reference count and only frees the context when the reference count has reached 0.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">No return values are used for this function.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ctx</span> - pointer to the SSL context, created with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">CyaSSL_CTX_free(ctx);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10">CyaSSL_new<br/></p>
<p class="paragraph_style_10">CyaSSL_free<br/></p>
<p class="paragraph_style_12"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_15"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_27.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_SetVersion<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">int CyaSSL_SetVersion(CYASSL* ssl, int version);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets the SSL/TLS protocol version for the specified SSL session (CYASSL object) using the version as specified by <span class="style_3">version</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This will override the protocol setting for the SSL session (<span class="style_3">ssl</span>) - originally defined and set by the SSL context (CyaSSL_CTX_new()) method type.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful the call will return <span class="style_3">SSL_SUCCESS</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">BAD_FUNC_ARG</span> will be returned if the input SSL object is NULL or an incorrect protocol version is given for <span class="style_3">version</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - a pointer to a CYASSL structure, created using CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">version</span> - SSL/TLS protocol version.  Possible values include CYASSL_SSLV3, CYASSL_TLSV1, CYASSL_TLSV1_1, CYASSL_TLSV1_2.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">int ret = 0;<br/></p>
<p class="paragraph_style_14">CYASSL* ssl;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ret = CyaSSL_SetVersion(ssl, CYASSL_TLSV1);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set SSL session protocol version<br/>}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_28.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_check_domain_name<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">int CyaSSL_check_domain_name(CYASSL* ssl, const char* dn);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">CyaSSL by default checks the peer certificate for a valid date range and a verified signature.  Calling this function before CyaSSL_connect() or CyaSSL_accept() will add a domain name check to the list of checks to perform.  <span class="style_3">dn</span> holds the domain name to check against the peer certificate when it’s received.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<span class="style_3"><br/></span></p>
<p class="paragraph_style_10">If successful the call will return <span class="style_3">SSL_SUCCESS</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_FAILURE</span> will be returned if a memory error was encountered.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - a pointer to a CYASSL structure, created using CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">dn</span> - domain name to check against the peer certificate when received.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">int ret = 0;<br/></p>
<p class="paragraph_style_14">CYASSL* ssl;<br/></p>
<p class="paragraph_style_14">char* domain = (char*) “<a title="http://www.yassl.com" href="http://www.yassl.com/">www.yassl.com</a>”;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ret = CyaSSL_check_domain_name(ssl, domain);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to enable domain name check<br/>}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">NA<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_29.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_cipher_list<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">int CyaSSL_set_cipher_list(CYASSL* ssl, const char* list);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets cipher suite list for a given CYASSL object (SSL session).  The ciphers in the list should be sorted in order of preference from highest to lowest.  Each call to CyaSSL_set_cipher_list() resets the cipher suite list for the specific SSL session to the provided list each time the function is called.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">The cipher suite list, <span class="style_3">list</span>, is a null-terminated text string, and a colon-delimited list.  For example, one value for <span class="style_3">list</span> may be<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">&quot;DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:AES256-SHA256&quot;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">Valid cipher values are the full name values from the cipher_names[] array in src/internal.c:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">RC4-SHA<br/></p>
<p class="paragraph_style_10">RC4-MD5<br/></p>
<p class="paragraph_style_10">DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">AES128-SHA<br/></p>
<p class="paragraph_style_10">AES256-SHA<br/></p>
<p class="paragraph_style_10">NULL-SHA<br/></p>
<p class="paragraph_style_10">NULL-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">PSK-AES128-CBC-SHA256<br/></p>
<p class="paragraph_style_10">PSK-AES128-CBC-SHA<br/></p>
<p class="paragraph_style_10">PSK-AES256-CBC-SHA<br/></p>
<p class="paragraph_style_10">PSK-NULL-SHA256<br/></p>
<p class="paragraph_style_10">PSK-NULL-SHA<br/></p>
<p class="paragraph_style_10">HC128-MD5<br/></p>
<p class="paragraph_style_10">HC128-SHA<br/></p>
<p class="paragraph_style_10">RABBIT-SHA<br/></p>
<p class="paragraph_style_10">NTRU-RC4-SHA<br/></p>
<p class="paragraph_style_10">NTRU-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">NTRU-AES128-SHA<br/></p>
<p class="paragraph_style_10">NTRU-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">AES128-SHA256<br/></p>
<p class="paragraph_style_10">AES256-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES128-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES256-SHA256<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDH-RSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDH-RSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon successful function completion, otherwise <span class="style_3">SSL_FAILURE</span> will be returned on failure.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL session, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">list</span> - null-terminated text string and a colon-delimited list of cipher suites to use with the specified SSL session.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">int ret = 0;<br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">ret = CyaSSL_set_cipher_list(ssl,<br/></p>
<p class="paragraph_style_14">“DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:AES256-SHA256”);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set cipher suite list<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_set_cipher_list<br/></p>
<p class="paragraph_style_10">CyaSSL_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_30.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_CTX_set_cipher_list<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">int  CyaSSL_CTX_set_cipher_list(CYASSL_CTX* ctx, const char* list);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets cipher suite list for a given CYASSL_CTX.  This cipher suite list becomes the default list for any new SSL sessions (CYASSL) created using this context.  The ciphers in the list should be sorted in order of preference from highest to lowest.  Each call to CyaSSL_CTX_set_cipher_list() resets the cipher suite list for the specific SSL context to the provided list each time the function is called.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">The cipher suite list, <span class="style_3">list</span>, is a null-terminated text string, and a colon-delimited list.  For example, one value for <span class="style_3">list</span> may be<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">&quot;DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:AES256-SHA256&quot;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">Valid cipher values are the full name values from the cipher_names[] array in src/internal.c:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">RC4-SHA<br/></p>
<p class="paragraph_style_10">RC4-MD5<br/></p>
<p class="paragraph_style_10">DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">AES128-SHA<br/></p>
<p class="paragraph_style_10">AES256-SHA<br/></p>
<p class="paragraph_style_10">NULL-SHA<br/></p>
<p class="paragraph_style_10">NULL-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">PSK-AES128-CBC-SHA256<br/></p>
<p class="paragraph_style_10">PSK-AES128-CBC-SHA<br/></p>
<p class="paragraph_style_10">PSK-AES256-CBC-SHA<br/></p>
<p class="paragraph_style_10">PSK-NULL-SHA256<br/></p>
<p class="paragraph_style_10">PSK-NULL-SHA<br/></p>
<p class="paragraph_style_10">HC128-MD5<br/></p>
<p class="paragraph_style_10">HC128-SHA<br/></p>
<p class="paragraph_style_10">RABBIT-SHA<br/></p>
<p class="paragraph_style_10">NTRU-RC4-SHA<br/></p>
<p class="paragraph_style_10">NTRU-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">NTRU-AES128-SHA<br/></p>
<p class="paragraph_style_10">NTRU-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">AES128-SHA256<br/></p>
<p class="paragraph_style_10">AES256-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES128-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES256-SHA256<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES128-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES256-SHA<br/></p>
<p class="paragraph_style_10">ECDH-RSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDH-RSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-RC4-SHA<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-DES-CBC3-SHA<br/></p>
<p class="paragraph_style_10">AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">DHE-RSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDHE-RSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDHE-ECDSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDH-RSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES128-GCM-SHA256<br/></p>
<p class="paragraph_style_10">ECDH-ECDSA-AES256-GCM-SHA384<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon successful function completion, otherwise <span class="style_3">SSL_FAILURE</span> will be returned on failure.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ctx</span> - pointer to the SSL context, created with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">list</span> - null-terminated text string and a colon-delimited list of cipher suites to use with the specified SSL context.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">ret = CyaSSL_CTX_set_cipher_list(ctx,<br/></p>
<p class="paragraph_style_14">“DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:AES256-SHA256”);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set cipher suite list<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_set_cipher_list<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_31.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_compression<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">int CyaSSL_set_compression(CYASSL* ssl);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">Turns on the ability to use compression for the SSL connection.  Both sides must have compression turned on otherwise compression will not be used.  The zlib library performs the actual data compression.  To compile into the library use --with-libz for the configure system and define HAVE_LIBZ otherwise.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">Keep in mind that while compressing data before sending decreases the actual size of the messages being sent and received, the amount of data saved by compression usually takes longer in time to analyze than it does to send it raw on all but the slowest of networks.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful the call will return <span class="style_3">0</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">NOT_COMPILED_IN</span> will be returned if compression support wasn’t built into the library.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL session, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">int ret = 0;<br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">ret = CyaSSL_set_compression(ssl);<br/></p>
<p class="paragraph_style_14">if (ret == 0) {<br/></p>
<p class="paragraph_style_14">// successfully enabled compression for SSL session<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">NA<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_32.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_fd<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">int CyaSSL_set_fd(CYASSL* ssl, int fd);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function assigns a file descriptor (<span class="style_3">fd</span>) as the input/output facility for the SSL connection.  Typically this will be a socket file descriptor.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10">If successful the call will return <span class="style_3">SSL_SUCCESS</span>, otherwise, <span class="style_3">SSL_FAILURE</span> will be returned.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL session, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">fd</span> - file descriptor to use with SSL/TLS connection.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">int sockfd;<br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ret = CyaSSL_set_fd(ssl, sockfd);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set SSL file descriptor<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_SetIOSend<br/></p>
<p class="paragraph_style_10">CyaSSL_SetIORecv<br/></p>
<p class="paragraph_style_10">CyaSSL_SetIOReadCtx<br/></p>
<p class="paragraph_style_10">CyaSSL_SetIOWriteCtx<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_33.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_group_messages<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">int CyaSSL_set_group_messages(CYASSL* ssl);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function turns on grouping of handshake messages where possible.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon success.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">BAD_FUNC_ARG</span> will be returned if the input context is null.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL session, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">ret = CyaSSL_set_group_messages(ssl);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set handshake message grouping<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_set_group_messages<br/></p>
<p class="paragraph_style_10">CyaSSL_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_34.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_CTX_set_group_messages<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">int CyaSSL_CTX_set_group_messages(CYASSL_CTX* ctx);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function turns on grouping of handshake messages where possible.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon success.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">BAD_FUNC_ARG</span> will be returned if the input context is null.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ctx</span> - pointer to the SSL context, created with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">ret = CyaSSL_CTX_set_group_messages(ctx);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set handshake message grouping<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_set_group_messages<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_new<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_35.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_session<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">int CyaSSL_set_session(CYASSL* ssl, CYASSL_SESSION* session);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets the session to be used when the SSL object, <span class="style_3">ssl</span>, is used to establish a SSL/TLS connection.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">For session resumption, before calling CyaSSL_shutdown() with your session object, an application should save the session ID from the object with a call to CyaSSL_get_session(), which returns a pointer to the session.  Later, the application should create a new CYASSL object and assign the saved session with CyaSSL_set_session().  At this point, the application may call CyaSSL_connect() and CyaSSL will try to resume the session.  The CyaSSL server code allows session resumption by default.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon successfully setting the session.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_FAILURE</span> will be returned on failure.  This could be caused by the session cache being disabled, or if the session has timed out.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL object, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">session</span> - pointer to the CYASSL_SESSION used to set the session for <span class="style_3">ssl</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">int ret = 0;<br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">CYASSL_SESSION* session;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ret = CyaSSL_get_session(ssl, session);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set the SSL session<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_get_session<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_36.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_CTX_set_session_cache_mode<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">long CyaSSL_CTX_set_session_cache_mode(CYASSL_CTX* ctx, long mode); <br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function enables or disables SSL session caching.  Behavior depends on the value used for <span class="style_3">mode</span>.  The following values for <span class="style_3">mode</span> are available:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_SESS_CACHE_OFF<br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span>- disable session caching.  Session caching is turned on by default.<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_SESS_CACHE_NO_AUTO_CLEAR<br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span>- Disable auto-flushing of the session cache.  Auto-flushing is turned on by default.<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon success.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ctx</span> - pointer to the SSL context, created with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">mode</span> - modifier used to change behavior of the session cache.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_CTX* ctx = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">ret = CyaSSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to turn SSL session caching off<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_flush_sessions<br/></p>
<p class="paragraph_style_10">CyaSSL_get_session<br/></p>
<p class="paragraph_style_10">CyaSSL_set_session<br/></p>
<p class="paragraph_style_10">CyaSSL_get_sessionID<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_set_timeout<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_37.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_timeout<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">int CyaSSL_set_timeout(CYASSL* ssl, unsigned int to);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets the SSL session timeout value in seconds.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon successfully setting the session.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">BAD_FUNC_ARG</span> will be returned if ssl is NULL.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL object, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">to</span> - value, in seconds, used to set the SSL session timeout.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">int ret = 0;<br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">ret = CyaSSL_set_timeout(ssl, 500);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set session timeout value<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_get_session<br/></p>
<p class="paragraph_style_10">CyaSSL_set_session<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_38.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_CTX_set_timeout<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">int CyaSSL_CTX_set_timeout(CYASSL_CTX* ctx, unsigned int to);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets the timeout value for SSL sessions, in seconds, for the specified SSL context.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">SSL_SUCCESS</span> will be returned upon success.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">BAD_FUNC_ARG</span> will be returned when the input context (<span class="style_3">ctx</span>) is null.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ctx</span> - pointer to the SSL context, created with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">to</span> - session timeout value in seconds<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_CTX*    ctx    = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">ret = CyaSSL_CTX_set_timeout(ctx, 500);<br/></p>
<p class="paragraph_style_14">if (ret != SSL_SUCCESS) {<br/></p>
<p class="paragraph_style_14">// failed to set session timeout value<br/></p>
<p class="paragraph_style_14">}<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_flush_sessions<br/></p>
<p class="paragraph_style_10">CyaSSL_get_session<br/></p>
<p class="paragraph_style_10">CyaSSL_set_session<br/></p>
<p class="paragraph_style_10">CyaSSL_get_sessionID<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_set_session_cache_mode<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_39.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_using_nonblock<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">void CyaSSL_set_using_nonblock(CYASSL* ssl, int nonblock);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function informs the CYASSL object that the underlying I/O is non-blocking.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">After an application creates a CYASSL object, if it will be used with a non-blocking socket, call CyaSSL_set_using_nonblock() on it. This lets the CYASSL object know that receiving EWOULDBLOCK means that the recvfrom call would block rather than that it timed out.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function does not have a return value.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL session, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">nonblock</span> - value used to set non-blocking flag on CYASSL object.  Use 1 to specify non-blocking, otherwise 0.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">CyaSSL_set_using_nonblock(ssl, 1);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_get_using_nonblock<br/></p>
<p class="paragraph_style_10">CyaSSL_dtls_got_timeout<br/></p>
<p class="paragraph_style_10">CyaSSL_dtls_get_current_timeout<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_40.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_set_verify<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">#include &lt;cyassl/ssl.h&gt;<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">void CyaSSL_set_verify(CYASSL* ssl, int mode, VerifyCallback verify_callback);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">typedef int (*VerifyCallback)(int, CYASSL_X509_STORE_CTX*);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets the verification method for remote peers and also allows a verify callback to be registered with the SSL session.  The verify callback will be called only when a verification failure has occurred.  If no verify callback is desired, the NULL pointer can be used for <span class="style_3">verify_callback</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">The verification <span class="style_3">mode</span> of peer certificates is a logically OR’d list of flags.  The possible flag values include:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_VERIFY_NONE<br/></p>
<p class="paragraph_style_10"><br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Client mode</span>:  the client will not verify the certificate received from the server and the handshake will continue as normal.<br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Server mode</span>:  the server will not send a certificate request to the client.  As such, client verification will not be enabled.<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_VERIFY_PEER<br/></p>
<p class="paragraph_style_10"><br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Client mode</span>:  the client will verify the certificate received from the server during the handshake.  This is turned on by default in CyaSSL, therefore, using this option has no effect.<br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Server mode</span>: the server will send a certificate request to the client and verify the client certificate received.<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_VERIFY_FAIL_IF_NO_PEER_CERT<br/></p>
<p class="paragraph_style_10"><br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Client mode</span>:  no effect when used on the client side.<br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Server mode</span>:  the verification will fail on the server side if the client fails to send a certificate when requested to do so (when using SSL_VERIFY_PEER on the SSL server).<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function has no return value.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ssl</span> - pointer to the SSL session, created with CyaSSL_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">mode</span> - session timeout value in seconds<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">verify_callback</span> - callback to be called when verification fails.  If no callback is desired, the NULL pointer can be used for verify_callback.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL* ssl = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14"><br/></p>
<p class="paragraph_style_14">CyaSSL_set_verify(ssl, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_CTX_set_verify<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_41.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_12">CyaSSL_CTX_set_verify<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Synopsis:<br/></p>
<p class="paragraph_style_10">void CyaSSL_CTX_set_verify(CYASSL_CTX* ctx, int mode, <br/></p>
<p class="paragraph_style_10">                                                       VerifyCallback verify_callback);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">typedef int (*VerifyCallback)(int, CYASSL_X509_STORE_CTX*);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Description:<br/></p>
<p class="paragraph_style_10">This function sets the verification method for remote peers and also allows a verify callback to be registered with the SSL context.  The verify callback will be called only when a verification failure has occurred.  If no verify callback is desired, the NULL pointer can be used for <span class="style_3">verify_callback</span>.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">The verification <span class="style_3">mode</span> of peer certificates is a logically OR’d list of flags.  The possible flag values include:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_VERIFY_NONE<br/></p>
<p class="paragraph_style_10"><br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Client mode</span>:  the client will not verify the certificate received from the server and the handshake will continue as normal.<br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Server mode</span>:  the server will not send a certificate request to the client.  As such, client verification will not be enabled.<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_VERIFY_PEER<br/></p>
<p class="paragraph_style_10"><br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Client mode</span>:  the client will verify the certificate received from the server during the handshake.  This is turned on by default in CyaSSL, therefore, using this option has no effect.<br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Server mode</span>: the server will send a certificate request to the client and verify the client certificate received.<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">SSL_VERIFY_FAIL_IF_NO_PEER_CERT<br/></p>
<p class="paragraph_style_10"><br/></p>
<ol>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Client mode</span>:  no effect when used on the client side.<br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><br/></p>
</li>
<li style="line-height: 14px; padding-left: 30px; text-indent: -30px; " class="full-width">
<p style="text-indent: -30px; " class="paragraph_style_16"><span style="font-size: 0px; position: relative; top: -7px; " class="Bullet"></span><span style="width: 30px; " class="inline-block"></span><span class="style_3">Server mode</span>:  the verification will fail on the server side if the client fails to send a certificate when requested to do so (when using SSL_VERIFY_PEER on the SSL server).<br/></p>
</li>
</ol>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Return Values:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10">This function has no return value.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Parameters:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">ctx</span> - pointer to the SSL context, created with CyaSSL_CTX_new().<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">mode</span> - session timeout value in seconds<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><span class="style_3">verify_callback</span> - callback to be called when verification fails.  If no callback is desired, the NULL pointer can be used for verify_callback.<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">Example:<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_14">CYASSL_CTX*    ctx    = 0;<br/></p>
<p class="paragraph_style_14">...<br/></p>
<p class="paragraph_style_14">CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER |<br/></p>
<p class="paragraph_style_14">                      SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0);<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_13">See Also:<br/></p>
<p class="paragraph_style_10">CyaSSL_set_verify<br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<p class="paragraph_style_10"><br/></p>
<div class="paragraph paragraph_style_10"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_42.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
</div>
<div style="clear: both; height: 0px; line-height: 0px; " class="tinyText"> </div>
</div>
</div>
<div style="height: 16px; width: 20px;  height: 16px; left: 706px; position: absolute; top: 51px; width: 20px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 20px; ">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/shapeimage_43.png" alt="" style="height: 16px; left: 0px; position: absolute; top: 0px; width: 20px; "/>
</div>
</div>
<div style="height: 19px; width: 19px;  height: 19px; left: 707px; position: absolute; top: 25px; width: 19px; z-index: 1; " class="tinyText style_SkipStroke_2">
<img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/United%20Kingdom(Great%20Britain).png" alt="" style="border: none; height: 19px; width: 19px; "/>
</div>
<div id="id17" style="height: 23px; left: 328px; position: absolute; top: 48px; width: 258px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_258_23" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_17">Questions? +1 (425) 245-8247</p>
</div>
</div>
</div>
<div style="height: 19px; width: 19px;  height: 19px; left: 685px; position: absolute; top: 25px; width: 19px; z-index: 1; " class="tinyText style_SkipStroke_2">
<a href="http://www.wolfssl.jp/" title="http://www.wolfssl.jp"><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/japan.png" alt="" style="border: none; height: 19px; width: 19px; "/></a>
</div>
<div id="id18" style="height: 28px; left: 593px; position: absolute; top: 44px; width: 119px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_119_28" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_18"><a class="class14" title="https://www.wolfssl.com/forums" href="https://www.wolfssl.com/forums">Support <span class="style_4">Forums</span></a></p>
</div>
</div>
</div>
<div style="height: 121px; width: 155px;  height: 121px; left: 32px; position: absolute; top: 5px; width: 155px; z-index: 1; " class="tinyText style_SkipStroke_2">
<a href="Home.html" title="Home.html"><img src="Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup_files/wolfssl_logo.png" alt="" style="border: none; height: 121px; width: 156px; "/></a>
</div>
<div style="height: 20345px; line-height: 20345px; " class="spacer"> </div>
</div>
<div style="height: 100px; margin-left: 0px; position: relative; width: 770px; z-index: 15; " id="footer_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
<div id="id19" style="height: 27px; left: 634px; position: absolute; top: 27px; width: 102px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_102_27" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_4"><a class="class15" title="Docs-wolfssl-manual-17-4-wolfssl-api-callbacks.html" href="Docs-wolfssl-manual-17-4-wolfssl-api-callbacks.html">Next Chapter</a></p>
</div>
</div>
</div>
<div id="id20" style="height: 25px; left: 35px; position: absolute; top: 27px; width: 125px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_125_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_19"><a class="class16" title="Docs-wolfssl-manual-17-2-wolfssl-api-certificates-keys.html" href="Docs-wolfssl-manual-17-2-wolfssl-api-certificates-keys.html">Previous Chapter</a></p>
</div>
</div>
</div>
<div id="id21" style="height: 25px; left: 323px; position: absolute; top: 27px; width: 125px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_125_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_7"><a class="class17" title="Docs-wolfssl-manual-toc.html" href="Docs-wolfssl-manual-toc.html">Table of Contents</a></p>
</div>
</div>
</div>
<div id="id22" style="height: 29px; left: 35px; position: absolute; top: 65px; width: 701px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_701_29" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_20">Copyright 2017 wolfSSL Inc.  All rights reserved.</p>
</div>
</div>
</div>
</div>
</div>
</div>
 </body>

<!-- Mirrored from www.wolfssl.com/wolfSSL/Docs-wolfssl-manual-17-3-wolfssl-api-context-session-setup.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Jan 2017 13:33:45 GMT -->
</html>
